package com.engine.salary.service;

import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 人员信息
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public interface SalaryEmployeeService {

    /**
     * 获取租户下的所有人员
     *
     * @return
     */
    List<DataCollectionEmployee> listAll(UseEmployeeTypeEnum empType);

    /**
     * 获取报表人员字段
     *
     * @return
     */
    List<DataCollectionEmployee> listAllForReport();

    /**
     * 根据薪资账套id查询人员
     *
     * @param salarySobId 薪资账套id
     * @param hasExtEmp 是否含非系统人员
     * @return
     */
    List<DataCollectionEmployee> listBySalarySobId(Long salarySobId, boolean hasExtEmp);

    /**
     * 获取人员信息
     *
     * @param ids
     * @return 全量
     */
    List<DataCollectionEmployee> getEmployeeByIdsAll(List<Long> ids);

    List<DataCollectionEmployee> listByIds(List<Long> ids);

    /**
     * 获取人员信息
     *
     * @param employeeId
     * @return 全量
     */
    DataCollectionEmployee getEmployeeById(Long employeeId);

    /**
     * 获取人员信息
     *
     * @param simpleEmployeeIds
     * @return 简单
     */
    List<DataCollectionEmployee> getEmployeeByIds(List<Long> simpleEmployeeIds);

    /**
     * 获取人员信息 包括次账号
     *
     * @param simpleEmployeeIds
     * @return 简单
     */
    List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> simpleEmployeeIds);

    /**
     * 获取当前登录人的信息
     * @param employeeId
     * @return
     */
//    DataCollectionEmployee getLoginEmployeeById(Long employeeId);

    /**
     * 筛选导入人员信息可以在人力资源池中匹配到的人员信息
     *
     * @param confValue     校验方式
     * @param employeeList  人力资源池
     * @param userName      姓名
     * @param deparmentName 部门
     * @param mobile        手机号
     * @param workcode      工号
     * @param idNo          身份证号
     * @param uid           人员id
     */
    List<DataCollectionEmployee> matchImportEmployee(String confValue, List<DataCollectionEmployee> employeeList, String userName, String deparmentName, String mobile, String workcode, String idNo, Long uid);

    String empValidType();

    List<DeptInfo> getDeptInfoList(List<Long> departmentIds);

    DeptInfo getDeptInfoById(Long departmentId);

    List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds);

    List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds);

    SubCompanyInfo getSubCompanyInfoById(Long subDepartmentId);

    List<SubCompanyInfo> getVirtualSubCompanyInfoList(List<Long> virtualSubDepartmentIds);

    List<PositionInfo> listPositionInfo(List<Long> positionIds);

    PositionInfo getPositionInfoById(Long positionId);

    List<DataCollectionEmployee> listEmployee();

    List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams);

    /**
     * 根据离职日期获取离职信息
     *
     * @param formatDate
     */
    Map<Long, String> getResignationMapByDate(String formatDate);

    /**
     * 扩展人员信息
     *
     * @param ids
     * @param param
     * @return
     */
    List<DataCollectionEmployee> expandEmployeeInfo(List<Long> ids, EmployeeInfoExpandDTO param);

    Map<Long, Map<String, String>> expandEmployeeMap(List<Long> ids, EmployeeInfoExpandDTO param);


    /**
     * 保存扩展信息
     *
     * @param param
     */
    void saveEmployeeExpandFieldSettings(EmployeeInfoExpandDTO param);

    /**
     * 获取扩展信息
     *
     * @param module
     * @return
     */
    EmployeeInfoExpandDTO getExpandFieldSettings(String module);

    /**
     * 根据虚拟部门获取人员信息
     *
     * @param virtualDepartmentIds
     */
    List<DataCollectionEmployee> getVirtualEmpByVirtualDepIds(List<Long> virtualDepartmentIds);

    /**
     * 根据虚拟分部获取人员信息
     *
     * @param virtualSubCompanyIds
     */
    List<DataCollectionEmployee> getVirtualEmpByVirtualSubCompanyIds(List<Long> virtualSubCompanyIds);

    /**
     * 根据部门或者分部查询人员
     *
     * @param subCompanyIds
     * @param departmentIds
     * @return
     */
    List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);

    List<Long> listBySubCompany(List<Long> subCompanyIds);

    List<Long> listByDepartment(List<Long> departmentIds);

    List<Long> listByJob(List<Long> jobIds);

    /**
     * 根据职称id获取职称信息
     * @param jobCallId
     * @return
     */
    JobCallInfo getJobCallInfoById(Long jobCallId);

    List<DataCollectionEmployee> snapshot(List<Long> employeeIds, Date snapshotTime);
}
